import api from './index'
import axios from 'axios'
import qs from 'qs'


let headers = {
  'Content-Type': 'application/json',
 // 'Authorization': 'Basic ' + localStorage.getItem('token')
}
export default {
  getCompany () {
    return axios.get(api.getCompany(), {params: {size: 9}}, {headers: headers})
  },
  userRegister (info) {
    return axios.post(api.userRegister(), JSON.stringify(info), {headers: headers})
  },
  hrRegister (info) {
    return axios.post(api.hrRegister(), JSON.stringify(info), {headers: headers})
  },
  getComName () {
    return axios.get(api.getComName(), {headers: headers})
  },

  userLogin (info) {
    return axios.post(api.userLogin(), JSON.stringify(info), {headers: headers})
  },
  hrLogin(info){
    return axios.post(api.hrLogin(), JSON.stringify(info), {headers: headers})
  },

  getUserInfo () {
    return axios.get(api.getUserInfo(), {headers: headers})
  },
  sendCode (phone) {
    return axios.get(api.sendCode(), {params: {phone: phone}}, {headers: headers})
  },
  Loginout () {
    return axios.get(api.Loginout(), {headers: headers})
  },
  sendResume (resumeInfo) {
    return axios.post(api.sendResume(), JSON.stringify(resumeInfo), {headers: headers})
  },
  deliveryList () {
    return axios.get(api.deliveryList(), {headers: headers})
  },
  putUserInfo (userInfo) {
    return axios.put(api.putUserInfo(), JSON.stringify(userInfo), {headers: headers})
  },
  changePhone (phone) {
    return axios.put(api.changePhone(), JSON.stringify(phone), {headers: headers})
  },
  changePass (password) {
    return axios.put(api.changePass(), JSON.stringify(password), {headers: headers})
  },
  changeEmail (email) {
    return axios.put(api.changeEmail(), JSON.stringify(email), {headers: headers})
  },
  getCompanyDetail (eid) {
    return axios.get(api.getCompanyDetail() + eid, {headers: headers})
  },
  getResume (userId) {
    return axios.get(api.getResume(), {params: {userId: userId}}, {headers: headers})
  },
  getJobDetail (jid) {
    return axios.get(api.getJobDetail() + jid, {headers: headers})
  },
  deliveryReusme (body) {
    return axios.post(api.deliveryReusme(), JSON.stringify(body), {headers: headers})
  },
  getMessage () {
    return axios.get(api.getMessage(), {headers: headers})
  },
  findJob (key) {
    return axios.get(api.findJob(), {params: {key: key}}, {headers: headers})
  },
  readMessage (info) {
    return axios.post(api.readMessage(), JSON.stringify(info), {headers: headers})
  },
  receiveResume () {
    return axios.get(api.receiveResume(), {headers: headers})
  },
  publishJob (jobinfo) {
    return axios.post(api.publishJob(), JSON.stringify(jobinfo), {headers: headers})
  },
  checkJob () {
    return axios.get(api.checkJob(), {headers: headers})
  },
  deletejob (id) {
    return axios.delete(api.deletejob(), {params: {id: id}}, {headers: headers})
  },

  recommendCandidate () {
    return axios.get(api.recommendCandidate(), {headers: headers})
  },
  recommendJob () {
    return axios.get(api.recommendJob(), {headers: headers})
  },
  getRecommandJob () {
    return axios.get(api.getRecommandJob(), {headers: headers})
  },
  // 添加公司
  addCompany (companyInfo) {
    return axios.post(api.getCompany(), JSON.stringify(companyInfo), {headers: headers})
  },
  // //获取学生端个人信息
  // getStudentInfo (sid) {
  //   return axios.get(api.getStudentInfo() + sid, {headers: headers})
  // },
  //获取学生端收藏公司列表
  getStuCollect(StuCollect) {
    return axios.post(api.getStuCollect(), StuCollect,{headers:headers})
  },
  //学生端保存修改的个人信息
  changeStudInfo(StuInfo){
    return axios.post(api.changeStudInfo(), JSON.stringify(StuInfo), {headers: headers})
  },
  getStudentInfo (id) {
    return axios.get(api.getStudentInfo() + id, {headers: headers})
  },
  getmyEntInfo (eid) {
    return axios.get(api.getmyEntInfo() + eid, {headers: headers})
  },
  getmyEntUserInfo(uid){
    return axios.get(api.getmyEntUserInfo() + uid, {headers: headers})
  },
  changeEntInfo (EntInfo) {
    return axios.post(api.changeEntInfo(), JSON.stringify(EntInfo), {headers: headers})
  },
  getmyEntCol(EntCollect){
    return axios.post(api.getResumeCol(), EntCollect, {headers: headers})
  },
  // 获取学生投递进度
  getCVProgress (obj) {
    return axios.post(api.getCVProgress(), obj)
  },
  getOnlineCV (obj) {
    return axios.post(api.getonlineCV(), obj)
  },
  hrChangePass(Passform){
    return axios.post(api.hrChangePass(), Passform, {headers: headers})
  },
  stuChangePass(Passform){
    return axios.post(api.stuChangePass(), Passform, {headers: headers})
  },
  searchRes (keyword) {
    return axios.get(api.getSearch()+keyword,{headers:headers})
  },
  getStatusing(info) {
    return axios.post(api.getStatusing(), info)
  }

}
